package com.zonski.jbots.engine;

import com.zonski.jbots.engine.InputStreamFactory;

import java.io.InputStream;
import java.io.IOException;

public class FileInputStreamFactory implements InputStreamFactory
{
    private String baseDirectory;
    private String extension;

    public FileInputStreamFactory(String baseDirectory, String extension)
    {
        this.baseDirectory = baseDirectory;
        this.extension = extension;
    }

    public InputStream getInputStream(String name)
        throws IOException
    {
        String path = this.baseDirectory + name + "." + this.extension;
        return this.getClass().getResourceAsStream(path);
    }
}
